<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
<title>邀请管理</title>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<link rel="stylesheet" href="../assets/mobile/top.css">
<link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/member.css" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/invite.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<link rel="stylesheet" href="../assets/app/css/app.css" />
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
</head>
<body>
<div class="h5-1yyg-v11">
<!--通用顶部-->
<div id="ios-top-box">
    <div id="header" class="bar bar-nav">
    <div class="titlebar">
    <a href="javascript:appClose('invitation',api);" style="margin-left:10px;"><i class="iconfont iconline-arrow-left"></i></a>
    <h1 class="title">邀请管理</h1>
    </div>
    </div>
</div>
<!--通用顶部结束-->
	<div id="wrapper" style="position:static !important;">
    <section class="clearfix g-member">
        <div class="clearfix m-round m-name">
            <div class="fl f-Himg">
                <a href="javascript:;" class="z-Himg">
                    <img data-original="" class="lazy" border=0/></a>
            </div>
            <div class="m-name-info"><p class="u-name">
                <b class="z-name gray01"></b><em class="u-mobile">(加载中)</em></p>
                <ul class="clearfix u-mbr-info"><li>可用云积分 <span class="orange f">加载中</span></li>
                    <li>余额 <span class="orange m">￥0</span></li>
                </ul>
            </div>
        </div>
        <div class="R-content">
            <div class="member-t"><h2>邀请好友</h2></div>
            <div id="divInvited" class="success-invitation gray02">
			<button class="common-btn" style="width:130px;margin:5px auto 0 auto;">分享给朋友</button>
            </div>
            <div id="divInviteInfo" class="get-tips gray01" style="">成功邀请 <span class="orange involvedtotal">加载中</span> 位会员注册，已有 <span class="orange involvednum">加载中</span> 位会员参与抢购</div>
            <div id="divList" class="list-tab SuccessCon"><ul class="listTitle"><li class="w200">用户名</li><li class="w200">时间</li><li class="w200">邀请编号</li><li class="w200">消费状态</li></ul>
                
				<p align="center" class="inloading">加载中</p>
                
                <div class="tips-con" style="display:none;"><i></i>您还未有邀请谁哦</div>
            </div>
           
        </div>
        <div id="divPageNav" class="page_nav"></div>
</div>
</section>
</div>
</div>
<script type="text/javascript">
apiready = function(){
	$(function(){
		if(getUserinfo()){
			var userinfo = getUserinfo();
			GetJPData(config.url+'/app.php?act=invitation&uid='+userinfo.uid,{},function(data){
				if(data['status'] == 1){
					$('.m-name-info .z-name').text(data['userinfo']['username']);
					$('.m-name-info .u-mobile').text(data['userinfo']['mobile']);
					$('.m-name-info .f').text(data['userinfo']['score']);
					$('.m-name-info .m').text('￥'+data['userinfo']['money']);
					$('.z-Himg img').attr('data-original',config.upload_url+'/'+data['userinfo']['img']);
					$('.involvedtotal').text(data['involvedtotal']);
					$('.involvednum').text(data['involvednum']);
					if(data['involvedtotal'] != 0){
						var html = '';
						for(var i in data['invifriends']){
							html += '<ul><li class="w200"><a href="javascript:openItem(\'userindex\','+data['invifriends'][i]['uid']+',function(id){localData.set(\'userid\',id);});" target="_blank" class="blue">'+data['invifriends'][i]['sqlname']+'</a></li>';
							html += '<li class="w200">'+data['invifriends'][i]['time']+'</li>';
							html += '<li class="w200">'+data['invifriends'][i]['uid2']+'</li>';
							html += '<li class="w200">'+data['invifriends'][i]['records']+'</li></ul>';
						}
						$('.inloading').hide();
						$('.inloading').after(html);
					}else{
						$('.inloading').hide();
						$('.tips-con').show();
					}
					lyzimg();
				}
			});
			
			GetJPData(config.url+'/app.php?act=shareconfig&uid='+userinfo.uid,{},function(data){
				$('.common-btn').click(function(){
					var wx = api.require('wx');
					wx.isInstalled(function(ret, err){
					    if(ret.installed){
					    	wx.shareWebpage({
					    	    apiKey: config.wxpay.app_id,
					    	    scene: 'session',
					    	    title: data['share_title'],
					    	    description: data['share_desc'],
					    	    thumb: data['share_img'],
					    	    contentUrl: data['share_link'],
					    	}, function(ret, err){
					    	    if(ret.status){
					    	        appToast('分享成功');
					    	    }else{
					    	        //
					    	    }
					    	});
					    }else{
					        api.alert({msg:'当前设备未安装微信客户端'});
					    }
					});
				});
			});
			
		}else{
			$.PageDialog.fail('请登录用户');
		}
	});
};
</script>
</body>
</html>